<?php
$count = count($items);
$ssFilter = $arrParam['ssFilter'];
	$lang = $ssFilter['lang'];
	if($lang == ''){
		$lang = 'vi';
	}else{
		$lang = $ssFilter['lang'];
	}

$info = new Zendvn_System_Info();
	$memberInfo = $info->getMemberInfo('id');
	if($memberInfo != ''){
		$tbltUser 				= new Zendvn_Models_Users();
		$user 					= $tbltUser->getItem(array('id'=>$memberInfo),array('task'=>'public'));
		$username = $user['first_name'] . " " . $user['last_name'];
	}
?>

                        <div class="hot-news width-100">
                            <div class="title-hot-news bag-main"><p>Thực đơn</p></div>
                            <div style="margin-top: 10px; color: #cfbf9d">Bạn có <b><?php echo $count?></b> món ăn trong thực đơn</div>
                            <?php if($count >0){
                            	$urlOptions = array(
                            				'module'=>'products',
                            				'controller'=>'index',
											'action'=>'view-cart',
				                   			'lang'=>$lang);
                            	$viewCartUrl = $view->url($urlOptions, "viewcart");
                            	$urlOptions = array(
                            				'module'=>'products',
                            				'controller'=>'index',
											'action'=>'order',
				                   			'lang'=>$lang);
                            	$orderUrl = $view->url($urlOptions, "order");
                            ?>
                            <div class="list">
<?php $tblProduct = new Zendvn_Models_Products();
	$sumPrice = 0;
	$sumSellof= 0;
	foreach ($items as $key => $value){
	
		$arrtmp = explode("-", $key);
		$item = $tblProduct->getItem(array("id"=> $arrtmp[1]),array("task"=>"public-get"));
		
		$cutTring 	= new Zendvn_File_CutTring();
		$title 		= $item['name'];
		$title 		= str_replace("\\"," ",$title);
		$alt		= $item['name'];
		if(!empty($item['alt_seo'])) $alt = $item['alt_seo'];
		$alt 		= str_replace("\\"," ",$alt);
							
		$summary 	= $item['summary'];
        $summary 	= str_replace("\\"," ",$summary);
		$summary 	= $cutTring->cutTring(100,$summary,null);
		
		if(!empty($item['picture'])){
		    $linkImg	= FILES_URL . '/products/images450x450/' . $item['picture'];
		    $picture 	= '<img title="'. $title .'" src="'. $linkImg .'"  alt="'.$alt.'" />';
		}else{
		    $linkImg	= $this->imgUrl . '/no-image.jpg';
		    $picture 	= '<img title="'. $title .'" src="'. $linkImg .'"  alt="'.$alt.'" />';
		}
		$urlOptions = array('module'=>'products','controller'=>'index',
							'action'=>'detail',
							'title'=>$item['alias'],
							'id'=>$item['id'],
                   			'lang'=>$lang);
		$price = number_format($item["price"],0);
		$sumSellof += $items[$key]*$item["price"]-$items[$key]*$item["selloff"];
		$sumPrice  += $items[$key]*$item["price"];
		
        $linkDetail = $view->url($urlOptions,'products-detail');
        
        $urlRemoveCart = array('module'=>'default',
								'controller'=>'index',
								'action'=>'ajax-remove-from-cart',
								'id'=>$item['id'],
                   			);
		
        $linkRemoveCart = $view->url($urlRemoveCart, 'default');?>
                       
                                <div class="row-list mar-top-15">
                                    <div class="bor-img width-45 float-left">
                                        <a href="<?php echo $linkDetail?>"><?php echo $picture;?></a>
                                    </div>
                                    <div class="desc width-50 float-right">
                                        <p><?php echo $summary; ?></p>
                                    </div>
                                     <div class="clear"></div>
                                    <div class="price mar-top-15" style="cursor: hand;">
                                        <a  onclick="xoaHang('#ajax-reload-menu','<?php echo $linkRemoveCart?>');" class="delete icon_cart" title="Xóa bỏ">&nbsp;</a>
                                        <p><?php echo $title?> &nbsp;&nbsp; <?php echo $items[$key]?> x <?php echo $price?> VNĐ</p>
                                    </div>
                                </div><!-- end row-list mar-top-15 -->

                                
                           	<?php } //end foreach?>
                            </div><!-- end list -->
                            <div class="line-solid"></div>
                            <div class="info mar-top-20">
                                <p class="sum-price"><?php echo number_format($sumPrice,0);?> VNĐ</p>
                            </div>
                             <?php if(!empty($username)):?>
                            <div class="info">
                           
                                <div class="info-left float-left"><?php echo $username?></div>
                                <div class="info-right float-right">
                                    <span class="star">&nbsp;</span>
                                    <span class="star">&nbsp;</span>
                                    <span class="star">&nbsp;</span>
                                </div>
                            </div>
                             <?php endif;?>
                            <div class="info">
                                <div class="info-left float-left">Khuyến mãi</div>
                                <div class="info-right float-right">- <?php echo number_format($sumSellof,0);?> VNĐ</div>
                            </div>
                            <div class="info">
                                <div class="info-left float-left">Tổng cộng</div>
                                <div class="info-right float-right"><?php echo number_format($sumPrice-$sumSellof,0);?> VNĐ</div>
                            </div>
                            <div class="info">
                                <a href="<?php echo $orderUrl?>" title="pay" class="bg-oranges">Thanh toán</a>
                                <a href="<?php echo $viewCartUrl?>" title="edit" class="bg-brown">Thay đổi</a>
                            </div>
							<?php } //end if?>
                        
</div><!-- end hot-news width-100 -->
